package com.github.baichuan.application.scaffold.jpa.application;

import com.github.baichuan.application.scaffold.domain.application.Application;
import com.github.baichuan.application.scaffold.domain.application.Realm;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Optional;

public interface ApplicationRepository extends JpaRepository<Application, String>, JpaSpecificationExecutor<Application> {
    Optional<Application> findByName(String name);

    Optional<Application> findByCode(String code);

    List<Application> findByRealm(Realm realm);

    int countByRealm(Realm realm);
}
